/**
 ****************************************************************************************************
 * @file        stmflash.h
 * @author      935848559@qq.com
 * @version     V1.0
 * @date        2024-03-12
 * @brief       STM32G0内部FLASH读写 驱动代码
 * @license     Copyright (c)
 ****************************************************************************************************
 * @attention
 *
 *
 ****************************************************************************************************
 */

#ifndef __STMFLASH_H
#define __STMFLASH_H


#include "main.h"


#define UPDATE_FLAG     0x123456        //升级标志
#define UPDATE_OVER     0xffffff       //升级完成标志

#define CONFIG_ADDR     0X8004800       //升级标志位存储分区
#define APP1_ADDR       0x8005000       //APP1 跳转地址
#define OTA_ADDR        0x8012800       //OTA  升级地址
#define ERASE_LEN       54              //擦除长度,单位kb



typedef enum
{
    FLASH_OK =0x00U,
    FLASH_ERROR,
}FLASH_SATAE_T;


uint8_t stmflash_read_byte(uint32_t faddr);
void Flash_test();
FLASH_SATAE_T Write_Flash(uint32_t address, uint8_t *buf, uint32_t length);
FLASH_SATAE_T Write_Config(uint64_t data);



#endif

